home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / GENCSRC.ZIP / READCHAR.C < prev    next >
C/C++ Source or Header  |  1987-11-21  |  480b  |  20 lines

  1.                                          /* Chapter 10 - Program 3 */
  2. #include "stdio.h"
  3.  
  4. main()
  5. {
  6. FILE *funny;
  7. char c;
  8.  
  9.    funny = fopen("TENLINES.TXT","r");
  10.  
  11.    if (funny == NULL) printf("File doesn't exist\n");
  12.    else {
  13.       do {
  14.          c = getc(funny);    /* get one character from the file */
  15.          putchar(c);         /* display it on the monitor       */
  16.       } while (c != EOF);    /* repeat until EOF (end of file)  */
  17.    }
  18.    fclose(funny);
  19. }
  20.